﻿//Authorization type
var useOAuth = false;

//if true alerts with error description will be shown for each error
var show_all_errors = false;

//OAuth parameters
var _response = false;
var authz_type = 'none'; // can be  'OAuth' 
var hostname = "http://social.atutor.ca/shindig/php";
var oauth_service_name = 'atutor';

//user is for testing purposes
//var user_id = 312;
var current_owner_id = 312;

//people
var rest_people_all = hostname + "/social/rest/people/" + current_owner_id + "/@all?alt=json";
var rest_people_friends = hostname + "/social/rest/people/" + current_owner_id + "/@friends?alt=json";
var rest_people_self = hostname + "/social/rest/people/" + current_owner_id + "/@self?alt=json";
var rest_people_requestor_self = hostname + "/social/rest/people/@me/@self?alt=json";
//groups
var rest_groups = hostname + "/social/rest/groups/" + current_owner_id + "?alt=json";
//activities
var rest_activities_self = hostname + "/social/rest/activities/" + current_owner_id + "/@self?alt=json";
var rest_activities_friends = hostname + "/social/rest/activities/" + current_owner_id + "/@friends?alt=json";

// functions for forming URL for RESTful services
// based on http://wiki.atutor.ca/display/atutorwiki/ATutor+Opensocial+API
function get_rest_people_all(user_id)
{
    return hostname + "/social/rest/people/" + user_id + "/@all?alt=json";
}

function get_rest_people_friends(user_id)
{
    return hostname + "/social/rest/people/" + user_id + "/@friends?alt=json";
}

function get_rest_people_self(user_id)
{
    return hostname + "/social/rest/people/" + user_id + "/@self?alt=json";
}
function get_rest_people_requestor_self()
{
    return hostname + "/social/rest/people/@me/@self?alt=json";
}

function get_rest_groups(user_id)
{
    return hostname + "/social/rest/groups/" + user_id + "?alt=json";
}

function get_rest_activities_self(user_id)
{
    return hostname + "/social/rest/activities/" + user_id + "/@self?alt=json";
}

function get_rest_activities_friends(user_id)
{
    return hostname + "/social/rest/activities/" + user_id + "/@friends?alt=json";
}

function get_rest_group_self(user_id)
{
    return "http://atutor-open-social-gadget.googlecode.com/svn/trunk/groups_mock.json?alt=json";
}

function get_rest_apps_self(user_id)
{
    return "http://atutor-open-social-gadget.googlecode.com/svn/trunk/apps_mock.json?alt=json";
}

function get_rest_app_settings_self(user_id)
{
    return "http://atutor-open-social-gadget.googlecode.com/svn/trunk/app_settings_mock.json?alt=json";
}

// Additional URLs - those which are different based on the server 
var image_url = "http://atutor.ca/atutor/demo/get_profile_img.php?id=";
var profile_url = "http://atutor.ca/atutor/demo/mods/_standard/social/sprofile.php?id=";

// paths for images displaying waiting. can be used these or any others
var waitImage_url = "http://atutor-open-social-gadget.googlecode.com/svn/trunk/waiting_bar.gif";
var update_image_url = "http://atutor-open-social-gadget.googlecode.com/svn/trunk/update_button.gif";
var update_image_moving_url = "http://atutor-open-social-gadget.googlecode.com/svn/trunk/update_button_moving.gif";

function get_profile_url(id)
{
    return profile_url + id;
}

function get_profile_image_url(id)
{
    return image_url + id;
}
